<template>
  <view class="order-details">
    <!-- 顶部导航栏 -->
    <view class="nav-bar">
      <view class="nav-background"></view>
      <view class="nav-content">
      </view>
    </view>

    <!-- 数据展示容器 - 脱离文档流重叠在蓝色背景上 -->
    <view class="data-container">
      <!-- 订单信息 -->
    <view class="order-info-card">
      <view class="order-header">
        <view class="order-title">订单信息</view>
        <view class="status-badge">已完成</view>
      </view>
      <view class="info-item">
        <text class="info-label">订单号</text>
        <text class="info-value">{{ orderData.orderNumber }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">服务项目</text>
        <text class="info-value">{{ orderData.serviceItem }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">服务门店</text>
        <view class="store-info">
          <text class="info-value">{{ orderData.serviceStore }}</text>
          <uni-icons type="paperplane" size="14" color="#3388FF" />
        </view>
      </view>
      <view class="info-item">
        <text class="info-label">下单时间</text>
        <text class="info-value">{{ orderData.orderTime }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">预约时间</text>
        <text class="info-value">{{ orderData.appointmentTime }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">车辆</text>
        <text class="info-value">{{ orderData.vehicle }}</text>
      </view>
      <view class="info-item" v-if="orderData.notes">
        <text class="info-label">备注</text>
        <text class="info-value">{{ orderData.notes }}</text>
      </view>
    </view>

    <!-- 订单详情 -->
    <view class="order-details-card">
      <view class="card-title">订单详情</view>
      <view class="service-list">
        <view class="service-item" v-for="(service, index) in orderData.services" :key="index">
          <text class="service-name">{{ service.name }}</text>
          <text class="service-price">¥{{ service.price }}</text>
        </view>
      </view>
    </view>

    <!-- 支付汇总 -->
    <view class="payment-summary-card">
      <view class="card-title">支付汇总</view>
      <view class="payment-item">
        <text class="payment-label">原价</text>
        <text class="payment-value">¥{{ orderData.originalPrice }}</text>
      </view>
      <view class="payment-item discount" v-if="orderData.storeDiscount > 0">
        <text class="payment-label">店家优惠</text>
        <text class="payment-value discount">-¥{{ orderData.storeDiscount }}</text>
      </view>
      <view class="payment-item discount" v-if="orderData.couponDiscount > 0">
        <text class="payment-label">优惠券</text>
        <text class="payment-value discount">-¥{{ orderData.couponDiscount }}</text>
      </view>
      <view class="payment-total">
        <text class="total-label">支付金额</text>
        <text class="total-amount">¥{{ orderData.finalPrice }}</text>
      </view>
    </view>

    <!-- 评价结果 -->
    <view class="evaluation-card">
      <view class="card-title">评价结果</view>
      <view class="evaluation-info">
        <text class="evaluation-label">评价时间</text>
        <text class="evaluation-value">{{ orderData.evaluationTime }}</text>
      </view>
      <view class="evaluation-rating">
        <text class="evaluation-label">评价结果</text>
        <view class="stars">
          <text 
            v-for="star in 5" 
            :key="star" 
            class="star"
            :class="{ 'star-filled': star <= orderData.rating }"
          >
            ★
          </text>
        </view>
      </view>
      <view class="evaluation-comment" v-if="orderData.comment">
        <text class="evaluation-label">评语</text>
        <text class="comment-text">{{ orderData.comment }}</text>
      </view>
    </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      orderData: {
        orderNumber: '121212112487878',
        serviceItem: '车辆保养',
        serviceStore: '大宝车辆维修店',
        orderTime: '2023-03-08 17:40',
        appointmentTime: '2023-03-09 17:40',
        vehicle: '奔驰FWE4/A98FHJ',
        notes: '',
        services: [
          { name: '车辆精洗', price: '39.90' },
          { name: '车辆附加费用', price: '0' }
        ],
        originalPrice: '59.90',
        storeDiscount: '20',
        couponDiscount: '10',
        finalPrice: '29.90',
        evaluationTime: '2023-04-10 11:09',
        rating: 5,
        comment: '服务非常满意，师傅技术专业，态度很好，下次还会选择这家店！'
      }
    };
  },
  onLoad(options) {
    // 接收从评价管理页面传递的参数
    if (options.orderId) {
      this.orderData.orderNumber = options.orderId;
    }
    if (options.userName) {
      // 可以根据用户名调整相关数据
      console.log('用户:', options.userName);
    }
    if (options.rating) {
      this.orderData.rating = parseInt(options.rating);
    }
    if (options.time) {
      this.orderData.evaluationTime = options.time;
    }
  },
  methods: {
  }
};
</script>

<style scoped>
.order-details {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  position: relative;
}

/* 导航栏样式 */
.nav-bar {
  position: relative;
  z-index: 10;
  height: 140px;
  padding-top: 30px;
  overflow: hidden;
}

.nav-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1F73F1;
  box-shadow: 0 8px 32px rgba(31, 115, 241, 0.3);
}

.nav-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 110px;
  padding: 0 20px;
}

/* 数据展示容器 - 绝对定位脱离文档流 */
.data-container {
  position: absolute;
  top: 80px;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0 20px;
}

/* 卡片通用样式 */
.order-info-card,
.order-details-card,
.payment-summary-card,
.evaluation-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  margin: 16px 0;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

/* 订单信息卡片 */
.order-info-card {
  margin-top: 0;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #3388FF;
}

.order-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.status-badge {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: #fff;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.info-value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  text-align: right;
  flex: 1;
  margin-left: 16px;
}

.store-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

/* 卡片标题 */
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #3388FF;
}

/* 服务列表 */
.service-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(51, 136, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(51, 136, 255, 0.1);
}

.service-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.service-price {
  font-size: 14px;
  color: #3388FF;
  font-weight: 600;
}

/* 支付汇总 */
.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.payment-item.discount {
  color: #ff4444;
}

.payment-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.payment-value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.payment-value.discount {
  color: #ff4444;
}

.payment-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px 0;
  border-top: 2px solid #3388FF;
  margin-top: 12px;
}

.total-label {
  font-size: 16px;
  color: #333;
  font-weight: 600;
}

.total-amount {
  font-size: 20px;
  color: #3388FF;
  font-weight: 700;
}

/* 评价结果 */
.evaluation-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 12px;
}

.evaluation-rating {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 12px;
}

.evaluation-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.evaluation-value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.stars {
  display: flex;
  gap: 2px;
}

.star {
  font-size: 18px;
  color: #E0E0E0;
  transition: color 0.2s ease;
}

.star-filled {
  color: #FFD700;
}

.evaluation-comment {
  padding: 12px;
  background: rgba(255, 193, 7, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 193, 7, 0.1);
}

.comment-text {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  margin-top: 8px;
  display: block;
}
</style>
